﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace FileManager
{
    class Record
    {
       
        public Record()
        {
        }
      
        /// <summary>
        /// 根据将要录像的文件名
        /// </summary>
        /// <param name="path">录像保存的路径</param>
        /// <returns></returns>
        public string GetRecordingFileName(string path)
        {
            string dir = path + string.Format("{0}\\{1:D2}\\{2:D2}\\", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                 if (!Directory.Exists(dir))
                    Directory.CreateDirectory(dir);
            string fileName = dir + DateTime.Now.ToString("HH-mm-ss");
            return fileName;
        }

        /// <summary>
        /// 获得当前目录下面所有的录像文件夹
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public DirectoryInfo[] GetRecordDay(string path)
        {  
            DirectoryInfo Dir = new DirectoryInfo(path);
            if (!Dir.Exists)
                return null;
            DirectoryInfo[] DirList = Dir.GetDirectories();
            if (DirList == null)
                return null;

            return DirList;

        }

        /// <summary>
        /// 获得当面目录下面所有的录像文件
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public FileInfo[] GetRecordList(string path)
        {
            DirectoryInfo Dir = new DirectoryInfo(path);
            if (!Dir.Exists) return null;
            FileInfo[] Files = Dir.GetFiles();
            if (Files == null)
                return null;

            return Files;
          
        }
          
    }
}
